import 'package:equatable/equatable.dart';
import 'package:backend.core/core/domain/entities/api/google_play/api_google_play_purchased_subscription_cancellation_survey_reason.dart';

const kApiGooglePlayPurchasedSubscriptionCancellationUnspecifiedSurveyReasonValue = 'unspecified';
const kApiGooglePlayPurchasedSubscriptionCancellationOtherSurveyReasonValue = 'other';
const kApiGooglePlayPurchasedSubscriptionCancellationInsufficientUseSurveyReasonValue =
    'insufficient_use';
const kApiGooglePlayPurchasedSubscriptionCancellationTechnicalIssuesSurveyReasonValue =
    'technical_issues';
const kApiGooglePlayPurchasedSubscriptionCancellationCostSurveyReasonValue = 'cost';
const kApiGooglePlayPurchasedSubscriptionCancellationNotBestAppSurveyReasonValue = 'not_best_app';

class ApiGooglePlayPurchasedSubscriptionCancellationSurveyReasonDto extends Equatable {
  const ApiGooglePlayPurchasedSubscriptionCancellationSurveyReasonDto._internal({
    required this.reasonString,
  });

  final String reasonString;

  @override
  List<Object?> get props {
    return [
      reasonString,
    ];
  }

  factory ApiGooglePlayPurchasedSubscriptionCancellationSurveyReasonDto.fromEntity(
      ApiGooglePlayPurchasedSubscriptionCancellationSurveyReason reason) {
    late final String reasonString;

    if (reason == ApiGooglePlayPurchasedSubscriptionCancellationSurveyReason.unspecified) {
      reasonString = kApiGooglePlayPurchasedSubscriptionCancellationUnspecifiedSurveyReasonValue;
    } else if (reason == ApiGooglePlayPurchasedSubscriptionCancellationSurveyReason.other) {
      reasonString = kApiGooglePlayPurchasedSubscriptionCancellationOtherSurveyReasonValue;
    } else if (reason ==
        ApiGooglePlayPurchasedSubscriptionCancellationSurveyReason.insufficientUse) {
      reasonString =
          kApiGooglePlayPurchasedSubscriptionCancellationInsufficientUseSurveyReasonValue;
    } else if (reason ==
        ApiGooglePlayPurchasedSubscriptionCancellationSurveyReason.technicalIssues) {
      reasonString =
          kApiGooglePlayPurchasedSubscriptionCancellationTechnicalIssuesSurveyReasonValue;
    } else if (reason == ApiGooglePlayPurchasedSubscriptionCancellationSurveyReason.cost) {
      reasonString = kApiGooglePlayPurchasedSubscriptionCancellationCostSurveyReasonValue;
    } else if (reason == ApiGooglePlayPurchasedSubscriptionCancellationSurveyReason.notBestApp) {
      reasonString = kApiGooglePlayPurchasedSubscriptionCancellationNotBestAppSurveyReasonValue;
    }

    return ApiGooglePlayPurchasedSubscriptionCancellationSurveyReasonDto._internal(
      reasonString: reasonString,
    );
  }

  @override
  String toString() {
    return reasonString;
  }
}
